<?php $this->Html->addCrumb('Product Listings','/products'); ?>
<?php $this->Html->addCrumb('Disapproved Products'); ?>
<div class="products">
	<div class="search-title"><?php __('You are in:');?> Disapproved Products. Go to  <?php
		$options=array('unsold'=>'Unsold Products','pending'=>'Pending Products','active'=>'Active Products');
		echo $this->Form->select('action',$options,null,array('empty'=>'--Select--','onchange' => 'redirectaction(this)'));
		?></div>
     <?php echo $this->Form->create('Product', array('action' => 'disapproved')); ?>
<br /><input type="text" name="data[keywords]" value="Enter keywords or item number"  onblur="if(this.value=='') this.value='Enter keywords or item number'" onfocus="if(this.value=='Enter keywords or item number') this.value='';" size="50" />
<select name="data[search_by]">
<option value="">Search BY</option>
<option value="item_title">Item Title</option>
<option value="item_number">Item Number</option>
</select>
<input type="submit" name="searchSubmit" value="Search" />
</form>
	 <div>
           &nbsp;            
        </div>
        <table cellpadding="0" cellspacing="0" width="100%"  class="tablesorter">
        <thead>
        <tr>		
        <th>&nbsp;</th>
        <th><?php echo $this->Paginator->sort('item #','id');?></th>
        <th><?php echo $this->Paginator->sort('Products','products_title');?></th>
        <th><?php echo $this->Paginator->sort('Price','products_price');?></th>
        <th>Disapproved On</th>
        <th class="actions"><?php __('Comments');?></th>
	</tr>
        </thead>
	<?php
	//pr($products);
        if(!empty ($products)){
	$i = 0;
	foreach ($products as $product):
		$class = ' class="even"';
		
		if ($i++ % 2 == 0) {
			//$class = ' class="odd"';
		}
	?>
        <tbody>
	<tr<?php echo $class;?> >
		
		<td class="pl_borderbottom">
        
         <?php 
                echo $html->image('thumbs/'.$thumbnail->render($product['Product']['products_thumbnailImage'],
                   array(
                        'path'=>'thumbs',
                        'width'=>140,
                        'height'=>140,
                        'quality'=>80
                        )
                    ),array("border"=>"0","title"=>$product['Product']['products_title'])
                );
                ?>
        <?php //echo'<img src="'.Configure::read('base_url').'img/uploads/'.$product['Product']['products_thumbnailImage'].'" alt="'.$product['Product']['products_title'].'" width="80" border="0" />';?>
                </td>
		<td align="center" class="pl_borderbottom"><?php echo $product['Product']['id']; ?></td>
		<td align="left" class="pl_borderbottom"><?php echo $this->Html->link(__($product['Product']['products_title'], true), array('action' => 'details/'.$product['Product']['id'])); ?></td>
		<td align="center" class="pl_borderbottom">$<?php echo $product['Product']['products_price']; ?></td>
		<td align="center" class="pl_borderbottom"><?php echo $product['Product']['disapproved_date']; ?></td>
		<td class="actions pl_borderbottom" align="center">
                <?php echo $product['Product']['disapprove_comments']; ?>
 <?php
//		$options=array('edit'=>'Edit','end'=>'End','sell'=>'Sell Similar','add'=>'Add Note');
//		echo $this->Form->select('action',$options,null,array('empty'=>'--Select--','id'=>$product['Product']['id'],'onchange' => 'redirectaction(this)'));
		?>		
		</td>
	</tr>
              <tr style="display:none;" id="available<?php echo $product['Product']['id']; ?>">
         <td colspan="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <form method="post" id="fcomment<?php echo $product['Product']['id']; ?>"  name="fcom" action="#">
             <input type="text" name="data[Note][note]" class="required" value="" id="comment<?php echo $product['Product']['id']; ?>" size="75"  style="background: none repeat scroll 0pt 0pt HoneyDew;"/>
             &nbsp;&nbsp;&nbsp;<input type="button" value="Save" onclick="return savenote(<?php echo $product['Product']['id']; ?>);" />
         &nbsp;&nbsp;&nbsp;<input type="button" value="Cancel" onclick="return entrycancel(<?php echo $product['Product']['id']; ?>);"/>
             </form>
             </td></tr>

<?php endforeach;
        }else{
            ?>
              <tr>
                <td colspan="6">
                    No Disapproved Product Found.
                </td>
              </tr>
    <?php
        }
      ?>
        </tbody>
	</table>
<?php echo $this->Html->css('table_css');?>
<?php  echo $html->script(array("jquery.tablesorter.min.js","jquery.tablednd.js")); ?>
   <style type="text/css">
      table.tablesorter tbody td {
    border-bottom: 1px solid #CCCCCC;
    border-right: 0px solid #CCCCCC;
    padding: 0px;
    vertical-align: top;
    }
   </style>
        <div  style="margin-top:3px;">
                     
        </div>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('< ', array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?> |
		<?php echo $this->Paginator->next(' >', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
<style type="text/css">
th,th a{font-size:14px; font-weight:700; text-decoration:none;color:black;}
</style>
<?php echo $html->script(array("jquery.validate.js")); ?>
<script type="text/javascript">
 
//jQuery("#select_all").click(function(){
//				var checked_status = this.checked;
//				jQuery("input[id=products_id]").each(function()
//				{
//                                 //var mid=jQuery(this).val();
//                                 this.checked = checked_status;
//    				 /*if(checked_status==true){
//                                         jQuery('#available'+mid).show();
//                                         }*/
//				});
//});

function redirectaction(param){
        var mval=jQuery(param).val();
        var mid=jQuery(param).attr('id');
        ////////delete//////////
        if(mval=='end'){
            var r=confirm("Do you really want to delete the product?");
            if(r){
              window.location = baseurl+'products/delete/'+mid;
            }
          }
      ////////////////////////Edit//////////
        if(mval=='edit'){
           window.location = baseurl+'products/edit/'+mid;
            }
    ////////////////////////add note//////////
        if(mval=='add'){
           //window.location = baseurl+'products/edit/'+mid;
            jQuery('#available'+mid).show();
            }
            ////////////////////////sell similar//////////
        /*if(mval=='edit'){
           window.location = baseurl+'products/edit/'+mid;
            }*/
                ////////////////////////unsold//////////
        if(mval=='unsold'){
           window.location = baseurl+'products/unsold/';
            //jQuery('#available'+mid).show();
            }
               ////////////////////////Pending//////////
        if(mval=='pending'){
           window.location = baseurl+'products/pending/';
            //jQuery('#available'+mid).show();
            }

  ////////////////////////active//////////
        if(mval=='active'){
           window.location = baseurl+'products/index';
            //jQuery('#available'+mid).show();
            }

    }
</script>
<style type="text/css">

    table.tablesorter tbody tr.even td {
        border: none;
}
table.tablesorter {
    background-color: #fff;
}
</style>